import os


# 删除空目录
def delete_empty_dir(path):
    root_dirs = os.listdir(path)
    count = 0
    for dir in root_dirs:
        if os.path.isdir(path + dir):
            print(dir + "是目录")
            num_file = os.listdir(path + dir + '\\')
            if len(num_file) == 0:
                os.rmdir(path + dir)
                count = count + 1
                print('删除空文件夹：' + path + dir)
            else:
                continue
        else:
            print(dir + "是文件")
    print('删除空文件夹完成')